<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
	<head>
		<script src="http://code.jquery.com/jquery-latest.min.js"></script>
		<script>
			$.ajax({
				url : '/ot-basket-wm/displayEmailPrintForm',
				data : data,
				success : success,
				dataType : dataType
			});
			
			function addAssetsToPage(){
			
			}
			
			function addAssetRow(asset) {
		
			}
		</script>
	</head>
	<body>
		<table>
			<form name="emailPrintForm" action="/idontknowyet">
				<tr>
					<td style="vertical-align: top">
						<div style="border: 3px solid; border-width: thin; padding: 20px">
							<div>
								<b>To:</b>
							</div>
							<div>
								<input type="text" style="width: 100%" name="toAddr" />
							</div>
							<div>
								<b>Subject:</b>
							</div>
							<div>
								<input type="text" style="width: 100%" name="subject" value="Emailing preview..." />
							</div>
							<div>
								<b>Body:</b>
							</div>
							<div>
								<textarea style="width: 100%; height: 200px" " name="body"></textarea>
							</div>
							<br />
							<div>
								<input name="sendAsHtml" type="checkbox" checked />
								Send as HTML
							</div>
							<br>
							<div>
								<input type="submit" value="Send" />
							</div>
						</div>
					</td>
				</tr>
				<!-- tr>
					<td colspan="2">
						<table>
							<tr>
								<input type="hidden" name="assetId-${count.index}" value="${emailPrintData.assetId}">
								<td>
									<img src="${emailPrintData.imageUrl}">
								</td>
								<td style="height: 100%; width: 100%">
									<textarea name="comment-${count.index}" style="height: 100%; width: 100%"></textarea>
								</td>
							</tr>
						</table>
					</td>
				<tr>
					<td>
						<table>
								<tr>
									<td style="align: right">
										<b><c:out value="${entry.key}" />:</b>
									</td>
									<td style="align: left">
										<c:out value="${entry.value}" />
									</td>
								</tr>
						</table>
					</td>
				</tr-->
			</form>
		</table>
		<script>
	//			alert(JSON.stringify($('form').serializeObject()));
	var $form = $('form');
	var data = getFormData($form);
	alert(JSON.stringify(data));
	function getFormData($form) {
		var unindexed_array = $form.serializeArray();
		alert(unindexed_array);
		var indexed_array = {};

		$.map(unindexed_array, function(n, i) {
			indexed_array[n['name']] = n['value'];
		});

		return indexed_array;
	}
</script>
	</body>
</html>